(require (planet schematics/schemeunit:3))

(define (pascal n m)
  (if (or (= n 1) (= n m))
      1
      (+ (pascal (- n 1) (- m 1))
         (pascal n (- m 1)))))

(check-equal? (pascal 1 1) 1)

(check-equal? (pascal 1 2) 1)
(check-equal? (pascal 2 2) 1)

(check-equal? (pascal 1 3) 1)
(check-equal? (pascal 2 3) 2)
(check-equal? (pascal 3 3) 1)

(check-equal? (pascal 1 4) 1)
(check-equal? (pascal 2 4) 3)
(check-equal? (pascal 3 4) 3)
(check-equal? (pascal 4 4) 1)

(check-equal? (pascal 1 5) 1)
(check-equal? (pascal 2 5) 4)
(check-equal? (pascal 3 5) 6)
(check-equal? (pascal 4 5) 4)
(check-equal? (pascal 5 5) 1)

;OK, revendo na Wikipedia, eu troquei os parâmetros de ordem e contei do 1
;ao invés do 0, mas enfim, tá funcionando
